//
//  AliveCell.m
//  
//
//  Created by 张领瑞 on 2017/9/6.
//
//

#import "AliveCell.h"

@interface AliveCell    ()<SwipeViewDelegate,SwipeViewDataSource>



@end
@implementation AliveCell


-(instancetype)initWithFrame:(CGRect)frame{
   self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self addSubview:self.swipeView];
    }
    return self;
}


-(SwipeView *)swipeView{
    if (_swipeView == nil) {
        _swipeView = [[SwipeView alloc] initWithFrame:self.frame];
        _swipeView.delegate = self;
        _swipeView.dataSource = self;
        _swipeView.itemsPerPage = 1;
        _swipeView.pagingEnabled = YES;
        [_swipeView setCurrentItemIndex:1];
    }
    return _swipeView;
}


#pragma SwipeViewDataSource
-(CGSize)swipeViewItemSize:(SwipeView *)swipeView{
    return self.frame.size;
}

-(UIView *)swipeView:(SwipeView *)swipeView viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view{
    if (index == 0) {
        view =[[UIView alloc]initWithFrame:self.frame];
        [view setBackgroundColor:[UIColor clearColor]];
    }
    if (index == 1) {
        view =[[UIView alloc]initWithFrame:self.frame];
        [view setBackgroundColor:[UIColor yellowColor]];
    }
    return view;
}
-(NSInteger)numberOfItemsInSwipeView:(SwipeView *)swipeView{
    return 2;
}





@end
